<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        for(var i=1000; i<=9999;i++) {
            var d1 = i % 10
            var d2 = Math.floor(i / 10) % 10
            var d3 = Math.floor(i / 100) % 10
            var d4 = Math.floor(i / 1000)
            if (Math.pow(d1,4)+Math.pow(d2,4)+Math.pow(d3,4)+Math.pow(d4,4) == i) {
                console.log(i)
            }
        }
    </script>
</body>
</html>